﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint;

namespace SPGael.Web.Controls.Menus
{
    public class SiteActionsMenu : System.Web.UI.WebControls.WebControl
    {
        protected override void CreateChildControls()
        {
            if (SPContext.Current.Web.CurrentUser != null
                && SPContext.Current.Web.CurrentUser.IsSiteAdmin)
            {
                SubMenuTemplate spgaelSubMenu = new SubMenuTemplate();
                spgaelSubMenu.ID = "PersonalActionsMenu.SPGaelMenu";
                spgaelSubMenu.Text = "About SPGael";
                spgaelSubMenu.ImageUrl = "/_layouts/images/lg_ICHLP.gif";

                // CodePlex submenu
                MenuItemTemplate codeplexMenu = new MenuItemTemplate();
                codeplexMenu.ID = "PersonalActionsMenu.SPGaelMenu.CodePlex";
                codeplexMenu.Text = "SPGael - CodePlex Projetcs";
                codeplexMenu.ImageUrl = "/_layouts/images/SPGAELcodeplex.jpg";
                codeplexMenu.ClientOnClickNavigateUrl = "http://www.codeplex.com/site/users/view/GaelDuhamel";
                spgaelSubMenu.Controls.Add(codeplexMenu);

                // Blog submenu
                MenuItemTemplate blogMenu = new MenuItemTemplate();
                blogMenu.ID = "PersonalActionsMenu.SPGaelMenu.MyBlog";
                blogMenu.Text = "SPGael - Blog";
                blogMenu.ImageUrl = "/_layouts/images/SPGaelLive.gif";
                blogMenu.ClientOnClickNavigateUrl = "http://gaelduhamel.spaces.live.com/";
                spgaelSubMenu.Controls.Add(blogMenu);

                // Rss submenu
                MenuItemTemplate rssMenu = new MenuItemTemplate();
                rssMenu.ID = "PersonalActionsMenu.SPGaelMenu.Rss";
                rssMenu.Text = "SPGael - My RSS Feed";
                rssMenu.ImageUrl = "/_layouts/images/SPGaelrss.png";
                rssMenu.ClientOnClickNavigateUrl = "http://feeds.feedburner.com/GaelDuhamel-SharepointEtCommerceServer";
                spgaelSubMenu.Controls.Add(rssMenu);

                this.Controls.Add(spgaelSubMenu);
            }
        }
    }
}